<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>登录</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@1.6/lib/index.css">
		<!-- 引入组件 -->
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/vant@1.6/lib/vant.min.js"></script>
		<script src="html5plus://ready"></script>
		<script src="../../js/ajax.js"></script>
		<script type="text/javascript" src="../../js/fanhui.js" ></script>
	</head>
	<body>
		<div id="app">
			<header>
				<van-row>
					<van-col span="6" offset="8">
						<img style="margin-top: 50px; margin-left: 25px; height: 100px; width: 100px; border-radius: 10px;" src="../../img/logo_200.png"/>
					</van-col>
				</van-row>
			</header>
			<section>
				<van-cell-group style="margin-top: 30px;">
					<van-field left-icon="phone" v-model="phone" placeholder="手机号" style="margin-top: 20px;"></van-field>
					<van-field left-icon="wap-home" type="password" v-model="pwd" placeholder="登录密码" style="margin-top: 10px;"></van-field>
				</van-cell-group>
				<a href="wjmm.html">
					<van-button type="default" style="float: right;">忘记密码</van-button>
				</a>
				<van-button size="large" type="danger" style="margin-top: 20px;" @click="login()">立即登录</van-button>
				<a href="zhuce.html">
					<van-button type="default" style="margin-left: 90px;">还没有注册？点我立即注册哦!</van-button>
				</a>	
			</section>
			<footer></footer>
		</div>
	</body>
	<script>
		var vm = new Vue({
			el: "#app",
			data:{
				phone:"",
				pwd:""
			},
			methods:{
				login:function(){
					var _this=this;
					ajax({
						url:"http://dsapi.ysd3g.com/api/login",
						data:{
							account:this.phone,
							password:this.pwd,
						},
						dataType:"jsonp",
						success:function(res){
							if(res.Error==false)
							{
								console.log(res);
								plus.storage.setItem("user",JSON.stringify(res));/*储存用户数据*/
								_this.$toast("登陆成功!");
								var personal = plus.webview.getWebviewById("personal");
								personal.reload();
								personal.show();
								plus.webview.currentWebview().close();//关闭本身页面
							}else{
								_this.$toast(res.Msg);
							}
						}
					});
				}
			},
			created:function(){
				
			}
		})
	</script>
</html>
